<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Сайт с кнопками</title>
  <style>
    .grid-container {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      grid-auto-rows: minmax(100px, auto);
      gap: 10px;
    }
    .button {
      width: 100%;
      height: 100%;
      text-align: center;
    }
    .red-button {
      background-color: red;
      color: white;
    }
    .green-button {
      background-color: green;
      color: white;
    }
  </style>
</head>
<body>
  <div class="grid-container">
    <div class="button">Яблоко</div>
    <div class="button red-button" onclick="sendDirection(-1)">-</div>
    <div class="button green-button" onclick="sendDirection(1)">+</div>

    <div class="button">Груша</div>
    <div class="button red-button" onclick="sendDirection(-1)">-</div>
    <div class="button green-button" onclick="sendDirection(1)">+</div>

    <div class="button">Виноград</div>
    <div class="button red-button" onclick="sendDirection(-1)">-</div>
    <div class="button green-button" onclick="sendDirection(1)">+</div>

    <div class="button">Инжир</div>
    <div class="button red-button" onclick="sendDirection(-1)">-</div>
    <div class="button green-button" onclick="sendDirection(1)">+</div>
  </div>

  <script>
    function sendDirection(direction) {
      sendArmSpeed(direction);
      sendHandSpeed(direction);
      sendShoulderSpeed(direction);
      sendFingerSpeed(direction);
    }

    function sendArmSpeed(direction) {
      if (direction === 1) { 
        fetch('/sendArmSpeed?speed=/Z2');
      } else {
        fetch('/sendArmSpeed?speed=/C2');
      }
    }

    function sendHandSpeed(direction) {
      if (direction === 1) {
        fetch('/sendHandSpeed?speed=/G2');
      } else {
        fetch('/sendHandSpeed?speed=/T2');
      }
    }

    function sendShoulderSpeed(direction) {
      if (direction === 1) {
        fetch('/sendShoulderSpeed?speed=/X2');
      } else {
        fetch('/sendShoulderSpeed?speed=/W2');
      }
    }

    function sendFingerSpeed(direction) {
      if (direction === 1) {
        fetch('/sendFingerSpeed?speed=/D2');
      } else {
        fetch('/sendFingerSpeed?speed=/A2');
      }
    }
  </script>
</body>
</html>
